<?php
/*
<User Registeration Controller> 
Author: Naseer Ahmad
Date:   14-07-2011
Last Updated by:
Last Updated on:
*/


class userRegistrationController extends appController
{
	function index()
	{
		
		$this -> set('msg', $this -> data['msg']);
		$this -> render('User Registeration');
	}
	
	
	function saveAddress()
	{
		v('User Nick Name ', $this -> data['usernickname']);
		v('User Full Name ',  $this -> data['userfullname']);	
		v('User Email ',  	$this -> data['useremail'],'email');
		v('User Password ',   $this -> data['userpassword']);
		v('Confirm Password ',   $this -> data['userpassword'], 'password', $this -> data['userpassword2']);
		//v('User Contact Info ', $this -> data['usercontactinfo']);
						
		if(!isset($_SESSION['v'])){
			$res = $this -> userRegistration -> addUser($this -> data['usernickname'],
														$this -> data['userfullname'],	
														$this -> data['useremail'],
														$this -> data['userpassword'],
														$this -> data['usercontactinfo']);	

			if($res){
				$msg="User Registeration Sucessfully Completed!";
				$page="home";
			}
			else{
				$msg="There is some error in inserting record!";
				$page="userRegistration";
			}
		}
		else{
			$page = "userRegistration";
			$msg= $_SESSION['v'];
		}
		
		$red=array('page' => $page,
				   'msg'  => $msg);
		$this -> redirect($red);
	}
	
	
	
}


?>